package com.aiwiown.face.request;

import com.aiwiown.face.ApiMethod;
import com.aiwiown.face.ApiObject;
import com.aiwiown.face.ApiRequest;
import com.aiwiown.face.internal.util.RequestParamUtils;
import com.aiwiown.face.response.PcTokenResponse;

import java.util.Map;

/**
 * <pre>
 *     此接口提供网页端人脸活体检测及比对服务，通过此接口客户可以获得一个用于网页端活体检测的token（token唯一且只能使用一次）。
 *     接口同时还能帮助完成人脸比对，并在完成活体检测后自动将人脸比对结果返回，方便集成开发。
 *     https://faceid.com/pages/documents/5680502
 * </pre>
 * PcTokenRequest
 * Date: 2020/5/11 0011
 * Time: 15:12
 *
 * @author tang.xiaosheng@qq.com
 */
public class PcTokenRequest implements ApiRequest<PcTokenResponse> {

    private String apiVersion = "v2";
    private static String apiUrl = "/get_token";

    private String bizContent;
    private ApiObject bizModel = null;

    @Override
    public ApiMethod getApiMethod() {
        return ApiMethod.POST;
    }

    @Override
    public String getApiUrl() {
        return "/liveness/" + this.apiVersion + apiUrl;
    }

    @Override
    public Map<String, String> getTextParams() throws IllegalAccessException {
        return RequestParamUtils.getTextParams(this.bizModel);
    }

    @Override
    public Map<String, byte[]> getByteArrayParams() throws IllegalAccessException {
        return RequestParamUtils.getByteArrayParams(this.bizModel);
    }

    @Override
    public String getApiVersion() {
        return null;
    }

    @Override
    public Class<PcTokenResponse> getResponseClass() {
        return PcTokenResponse.class;
    }

    @Override
    public String getBizContent() {
        return this.bizContent;
    }

    public void setBizModel(ApiObject bizModel) {
        this.bizModel = bizModel;
    }

    @Override
    public String signVersion() {
        return null;
    }

    @Override
    public String getSignInfo(String apiKey, String secretKey) throws Exception {
        return null;
    }
}
